var _behaviorView = _interopRequireDefault(require("../behavior-view")), _socket = _interopRequireDefault(require("../../public/utils/socket")), _contactUtil = require("../../utils/contact-util");

function _interopRequireDefault(t) {
    return t && t.__esModule ? t : {
        default: t
    };
}

var AUTO_CLOSE_TIME = 5e3;

Component({
    behaviors: [ _behaviorView.default ],
    properties: {
        card: {
            type: Object,
            value: {},
            observer: function(t) {}
        },
        top: {
            type: String,
            value: "0px"
        }
    },
    data: {},
    ready: function() {
        this.initSocket();
    },
    methods: {
        initSocket: function() {
            var i = this;
            _socket.default.on("event.minicard_join", function(t) {
                var e = t.params;
                i.data.card.guid === e.guid && (i.setData({
                    msg: e,
                    isShown: !0
                }), (0, _contactUtil.loadContact)(), clearTimeout(i.timer), i.timer = setTimeout(function() {
                    i._onCancel();
                }, AUTO_CLOSE_TIME));
            });
        },
        _gotoContact: function() {
            this.$route("/pages/tabbar/contacts/contacts"), this._onCancel();
        }
    }
});